package cn.zn.modules.zzsys.cur.service.impl;

import cn.zn.modules.zzsys.cur.dao.TSysDicTypeMapper;
import cn.zn.modules.zzsys.cur.entity.TSysDicType;
import cn.zn.modules.zzsys.cur.service.TSysDicTypeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
@Slf4j
public class TSysDicTypeServiceImpl extends ServiceImpl<TSysDicTypeMapper, TSysDicType> implements TSysDicTypeService {

    @Override
    public TSysDicType queryByCode(String dicTypeCode) {
        TSysDicType tSysDicType = super.getOne(new QueryWrapper<TSysDicType>().eq("CODE_", dicTypeCode));
        if (tSysDicType == null) {
            tSysDicType = new TSysDicType();
            tSysDicType.setCode(dicTypeCode);
            tSysDicType.setName(dicTypeCode);
            super.save(tSysDicType);
        }
        return tSysDicType;
    }
}




